﻿using Interview.API.Admin.ResultDto;
using Interview.API.Admin.ResultDto.Paged;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace Interview.API.Admin.ServiceInterface
{
    public interface IBaseService<TIntput,TOutput> where TOutput : class
    {
        Task<ServiceResult<TOutput>> InsertAsync(TIntput t);
        Task<ServiceResult> DeleteAsync(TIntput t);
        Task<ServiceResult> UpdateAsync(TIntput t);
        Task<ServiceResult<IEnumerable<TOutput>>> GetAllAsync();
        Task<ServiceResult<PagedList<TOutput>>> GetAllAsync(int pageIndex = 1, int pageSize = 20);
        Task<ServiceResult<PagedList<TOutput>>> GetAllAsync(string key, int pageIndex = 1, int pageSize = 20);

        //在接口实现中（API中不能出表达示，所以去掉了这个方法）
        //Task<ServiceResult<PagedList<IEnumerable<TOutput>>>> GetAllAsync(
        //    System.Linq.Expressions.Expression<Func<TOutput, bool>> where,int pageIndex,int pageSize);
        Task<ServiceResult<TOutput>> GetSingle(string id);
    }
}
